package br.com.divulgaqui.service;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import br.com.divulgaqui.client.PerfilServiceBeanLocal;
import br.com.divulgaqui.entity.Perfil;
import br.com.divulgaqui.persistence.dao.PerfilDAO;
import br.com.divulgaqui.persistence.daoimpl.PerfilDAOimpl;

@Stateless
public class PerfilServiceBean implements PerfilServiceBeanLocal {
	
	@PersistenceContext(unitName="divulgaqui")
	EntityManager entityManager;
	
	PerfilDAO perfilDAO;
	
	@PostConstruct
	void init(){
		perfilDAO = new PerfilDAOimpl(entityManager);
	}
	
	@Override
	public void salvar(Perfil perfil) {
		perfilDAO.salvar(perfil);
	}

	@Override
	public List<Perfil> listar() {
		return perfilDAO.listar();
	}

}
